package com.wfh.mianshiji.mq;

import com.wfh.mianshiji.model.dto.MqMessageDto;
import jakarta.annotation.Resource;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import static com.wfh.mianshiji.config.RabbitMqConfig.EXCHANGE_NAME;
import static com.wfh.mianshiji.config.RabbitMqConfig.QUEUE_NAME;

/**
 * @Title: Producer
 * @Author wangfenghuan
 * @Package com.wfh.mianshiji.mq
 * @Date 2025/11/3 08:54
 * @description:
 */
@Component
public class Producer {


    @Resource
    private RabbitTemplate rabbitTemplate;

    /**
     * 发送消息
     *
     * @param mqMessageDto
     */
    public void sendMsg(MqMessageDto mqMessageDto) {
        // 发送消息
        rabbitTemplate.convertAndSend(EXCHANGE_NAME, QUEUE_NAME, mqMessageDto);
    }

}
